package t327.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import t327.mapper.Samplemapper;
import t327.pojo.views.SampleSheetListView;
import t327.service.iter.ISampleService;

import java.util.List;


@Service
@Transactional
public class SampleServiceImpl implements ISampleService {
    @Autowired
    private Samplemapper samplemapper;

    @Override
    public List<SampleSheetListView> getAllSampleSheetList() {
        return samplemapper.getAllSampleSheetList();
    }

    @Override
    public int deleteSampleSheetListView(Long sampleSheetId) {

        return samplemapper.logicDeleSampleSheetListView(sampleSheetId);
    }

    @Override
    public int updateAuditStatus(Long sampleSheetId, Long auditStatus) {
        SampleSheetListView sampleSheet = samplemapper.getSampleSheetById(sampleSheetId);

        if (sampleSheet != null) {
            // 更新审核状态
            sampleSheet.setAuditStatus(auditStatus);

            return samplemapper.updateAuditStatus(sampleSheetId,auditStatus);
        } else {
            // 样品单不存在
            return 0;
        }
    }
    }



